
class StringField < NamedField

  def class_body
    if name && name.length > 0
      "property :#{name}, String\n"#+
      #"attr_reader :#{name}\n"+
      #"def #{name}= v\n attribute_set(:#{name}, v)\nend\n"+
      #"def #{name}\n  attribute_get(:#{name})\nend"
    end
  end

#  def creator e
#    InputText.new(:name => (form_id :value), :value => value)
#  end

  def thingswecanadd
    [InputThing]
  end

  class Test < FwTest
    def test_class_body
      nf = StringField.new('whole_name')
      body = nf.class_body.split("\n")
      eq body[0], 'property :whole_name, String'
    end

    def test_generate_no_code_when_name_empty
      eq StringField.new.class_body, nil
    end
  end
end
